package com.zxy.furns.dao.impl;

import com.zxy.furns.dao.BasicDAO;
import com.zxy.furns.dao.OrderDAO;
import com.zxy.furns.entity.Order;

import javax.print.attribute.standard.OrientationRequested;
import java.util.List;

/**
 * ClassName: OrderDAOImpl
 * Package: com.zxy.furns.dao.impl
 *
 * @Author zxy
 * @Create 2025/3/25 23:14
 * @Version 1.0
 * title:
 * Description:
 */
public class OrderDAOImpl extends BasicDAO<Order> implements OrderDAO {
    @Override
    public int saveOrder(Order order) {
        String sql = "INSERT INTO `order`(id,create_time,price,status,member_id) VALUES(?,?,?,?,?)";
        return update(sql, order.getId(), order.getCreateTime(), order.getPrice(), order.getStatus(), order.getMemberId());
    }

    @Override
    public List<Order> listOrder(int memberId) {
        String sql ="SELECT id,create_time createTime,price,status FROM `order` WHERE member_id=?";
        return  queryMulti(sql,Order.class,memberId);
    }
}
